package bargain

import (
	"activity_srv/activity"
	"api/internal/respons"
	"api/internal/svc"
	"api/internal/types"
	"context"
	"go.uber.org/zap"
	"smart-health-platforms/pkg"

	"github.com/zeromicro/go-zero/core/logx"
)

type BargainListLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewBargainListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BargainListLogic {
	return &BargainListLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

// 砍价活动列表
func (l *BargainListLogic) BargainList(req *types.BargainListRequest) (resp *types.Response, err error) {
	list, err := l.svcCtx.ActivityRpc.BargainList(l.ctx, &activity.BargainListRequest{})
	if err != nil {
		pkg.Error("失败", zap.Error(err))
		return nil, err
	}
	return respons.Success(list), nil
}
